<!DOCTYPE html>
<html>
{include file="head.html"}
<body>
<div class="body">
<div class="header"> <a href="{$appymdian}?m=ymdian_product&a=order"  class="left-btn"><span class="iconfont icon-back"></span></a>
  <div class="title">添加产品</div>
  <div class="right-btn" id="showSearch"><span class="iconfont icon-search"></span></div>
</div>
<div class="main-body ">
<div class="tabs-border"> {foreach item=c from=$kucunlist} <a href="{$appymdian}?m=ymdian_product&a=add&kcid={$c.kcid}" class="item {if $c.kcid eq get('kcid')}active{/if}">{$c.title}</a> {/foreach} </div>
<div class="pd-5" id="searchBox" style="display:none">
<form method="get" action="{$appymdian}">
<input type="hidden" name="m" value="ymdian_product" />
<input type="hidden" name="a" value="add" />
<input type="hidden" name="kcid" value="{$smarty.get.kcid}">

<div class="input-row">
  <label >产品名称</label>
  <input type="text" name="keyword" value="{$smarty.get.keyword}" />
</div>
<div class="form-btns">
  <button type="submit"   class="btn btn-warning btn-row"  >
  搜索
  </button>
</div>
</form>
</div>

<style>
 	 
		.plist .item .num{width:30px; margin-right:10px; height:20px;}
		.plist .item .catid{width:60px; margin-right:10px; height:22px;}
    </style>
<div class="plist"> {get data=catlist model=ymdian_product fun=catlist()}
  {foreach item=c from=$kclist}
  <div class="item">
    <div class="g-sd1"> <img src="{$c.imgurl|images_site}.100x100.jpg"> </div>
    <div class="g-mn1">
      <div class="g-mn1c">
        <div class="title">{$c.title}</div>
        <div>{$c.kc_title}</div>
        <div class="row-price"> <span>库存：{$c.total_num}</span> <span>销量：{$c.buy_num}</span> <span>￥{$c.price}元</span> </div>
        {if $c.ymdian}
        <div class="row-price"> <span>夜猫库存：{$c.ym_total_num}</span> <span>夜猫销量：{$c.ym_buy_num}</span> </div>
        {/if}
        <div class="pro">
          <input type="hidden" class="num" value="1">
          <a href="javascript:;" productid="{$c.id}" kcid="{$c.kcid}" class="btn  btn-small btn-success addProduct" url="{$appymdian}?m=ymdian_product&a=addProduct&productid={$c.id}&ajax=1">添加</a></div>
      </div>
    </div>
    <div class="clearfix"></div>
  </div>
  {/foreach} </div>
</div>
<script>
$(function(){
	$("#showSearch").on(CLICK,function(){
		$("#searchBox").toggle();
	});
	$(document).on("click",".addProduct",function(){
		var obj=$(this);
		$.get("{$appymdian}?m=ymdian_product&a=addProduct&ajax=1&productid="+$(this).attr("productid")+"&kcid="+$(this).attr("kcid")+"&total_num="+$(this).siblings(".num").val(),function(data){
			skyToast(data.message);
		},"json");
		
	});
});
</script>
</div>
</div>
{include file='footer.html'}
